import java.io.IOException;

public class Client implements PaymentService {
    private static String TOKEN;

    // 返回对应的token值
    public String isAvailable() throws IOException {
        TOKEN = isAvailable.isAvailable();
        return TOKEN;
    }

    // 付款
    public void pay(double amount, PaymentCallback callback) {
        pay pay = new pay();
        pay.pay(amount, callback);
    }

    // 退款
    public void refunds(double amount, RefundCallback callback) {
        refunds refunds = new refunds();
        refunds.refunds(amount, callback);
    }

    // 查询订单
    public String query(String orderId) throws IOException {
        query query = new query();
        return query.query(orderId, TOKEN);
    }

    // 查询退款单
    public String queryRefunds(String refundId) throws IOException {
       queryRefunds queryRefunds = new queryRefunds();
       return queryRefunds.queryRefunds(refundId, TOKEN);
    }
}
